home *** CD-ROM | disk | FTP | other *** search
- Path: in2.uu.net!novia!usenet
- From: srwillrd@novia.net (William E. Kempf)
- Newsgroups: comp.lang.c++,comp.lang.c,comp.os.msdos.programer,comp.os.ms-windows.programmer.misc
- Subject: Re: fastest code
- Date: Fri, 05 Apr 1996 21:12:21 GMT
- Organization: Novia Internetworking <> 28.8kbps dialup; 402/390-2NET
- Message-ID: <31658942.99299605@204.248.25.97>
- References: <316112A2.7D37@public.sta.net.cn> <31611AC9.7DE1@wight.hursley.ibm.com> <3162c21a.6084138@204.248.25.97> <31641DE2.31D4@halcyon.com>
- NNTP-Posting-Host: 167.16.65.84
- X-Newsreader: Forte Agent .99e/32.201
-
- Glen Parker <glenebob@halcyon.com> wrote:
-
- :William E. Kempf wrote:
- :>
- :> Max Waterman <dwater@wight.hursley.ibm.com> wrote:
- :>
- :> :Xu Yifeng wrote:
- :> :> I'd like to know which C/C++ compiler generate fastest code?
- :> :> Borland, Microsoft, Watcom, High or Symantec?
- :> :
- :> :The Cray C compiler would probably generate the fastest code.
- :> :
- :> :Max.
- :> :--
- :> : ___ mailto:max@lton.u-net.com
- :> : / / / _ / / _ __ __ _ __ _
- :> : / / / /_/ |/ / / / /_/ / /_ /_/ / / / /_/ /| /
- :> :/ / / / / /| /_/_/ / / / /_ / | / / / / / / |/
- :>
- :> No, it may run faster because the Cray computer is faster, but that
- :> doesn't mean it is faster code (Big-O notation kinda thing) :-).
- :>
- :> -----
- :> William E. Kempf : http://www.novia.net/~srwillrd
- :> "Sir Willard" : mailto:srwillrd@novia.net (home)
- :> Knight of the Ascii Table : mailto:wekempf@marlton.1dc.com (work)
- :
- :
- :If you run a c-compiler on a faster computer,
- :wouldn't it make faster code? Or code faster? Now
- :I'm confused
- :
- :
- Ok, my cutsy remark has confused several people, so I will explain.
- In computer science, algorithms (and this will apply to the final
- machine code generated by a compiler) are evaluated for speed in a
- system independant way, through a formula known as Big-O notation. So
- code is not said to be faster just because it is running on a faster
- machine. The executable program may be faster, but the underlying
- code may not be. All kinds of things can effect this, such as wether
- or not the compiler moves variable declarations outside of loops, etc.
-
- As an example: if the C code looked like this...
-
- while (condition)
- {
- a = 10;
- // other code that does not change a
- }
-
- a good optimizing compiler would move the a = 10 statement before the
- loop in the final machine code. If an Intel based compiler made this
- optimization while the Cray c-compiler did not, the Intel compiler
- would have generated faster "code", while the Cray c-compiler would
- still have an executable that runs quicker, simply because the Cray is
- quicker.
-
- The original question was looking for this kind of information (even
- if the poster does not understand Big-O, which I don't know if he did
- or not). He wants to know what compiler will best optimize the
- machine language code generated for a specific OS and computer
- architecture.
-
- I don't have the answer to his question, as the compilers are changing
- at such a rate they would need to be re-bench marked with every new
- release. I do know that at one time Watcomm was the fastest, but I
- don't know if this is still true.
-
- -----
- William E. Kempf : http://www.novia.net/~srwillrd
- "Sir Willard" : mailto:srwillrd@novia.net (home)
- Knight of the Ascii Table : mailto:wekempf@marlton.1dc.com (work)
-